Scalar-valued Functions [dbo].[fn_asi_StripParens]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@stringnvarchar(4000)8000
Permissions
TypeActionOwning Principal
GrantExecuteIMIS
SQL Script
CREATE FUNCTION [dbo].[fn_asi_StripParens](@string nvarchar(4000))
     RETURNS nvarchar(4000)
AS
BEGIN
    DECLARE @result nvarchar(4000)
    DECLARE @count int
    SET @count = 0
    SET @result = LTRIM(RTRIM(@string))
    WHILE (LEFT(@result, 1)='(' OR LEFT(@result,1)='''')
    BEGIN
        SET @result = SUBSTRING(@result, 2, LEN(@result) - 1)
        SET @count = @count + 1
    END
    IF (LEN(@result) - @count) <= 0
        SET @result = ''''''
    ELSE
        SET @result = LEFT(@result, LEN(@result) - @count)
    RETURN @result
END

GO
GRANT EXECUTE ON  [dbo].[fn_asi_StripParens] TO [IMIS]
GO
Uses